<template>
	<view class="">
		<!-- <web-view src="https://smlh5.esign.cn/auth/h5/index?authFlowId=OF-266594f1c6**4&clientType=ALL&appId=4438*****"
			id="webview" onMessage="onWebviewMessage">
		</web-view> -->
	</view>
</template>

<script>
	import Template from '@/api/e-bao-signing.js'
	export default {
		data() {
			return {
				templateId: '5029d72628fc4df4a17745764352ec69', // 合同模板id
			}
		},
		onLoad() {
			this.getTemDetail()
		},
		methods: {
			async getTemDetail() {
				const res = await Template.temDetailGet(this.templateId)
				console.log('合同详情', res);
			},
			onWebviewMessage(message) {
				console.log('onWebviewMessage>>>>>', message)
				const {
					detail: {
						type,
						token,
						url,
						authFlowId
					}
				} = message
				//授权认证流程才返回authFlowId
				if (type === 'IDENTITY_ALI_FACE_AWAKE') {
					my.startAPVerify({
						url,
						certifyId: token,
						success: function(res) {
							console.log('success', res)
						},
						fail: function(res) {
							console.log('fail', res)
						},
						complete: function(res) {
							console.log('complete', res)
						}
					})
					return
				}
				if (type === 'WILL_DONE') {
					console.log('WILL_DONE>>do something')

					return
				}
				if (type === 'RN_DONE') {
					console.log('RN_DONE>>do something')

					return
				}
				if (type === 'E_AUTH_FINISHED') {
					console.log('RN_DONE>>do something')
					console.log("authFlowId", authFlowId)
					// 要跳转的页面或进行其他操作
					// my.navigateTo({
					//   url: '/pages/index/index',
					//   });
					return
				}

			}
		},

	}
</script>

<style lang="scss" scoped>

</style>